﻿using System;
using System.Windows.Forms;
using WindowsFormsApp4.DLL;

namespace WindowsFormsApp4
{
    public partial class UserForm : Form
    {
        public UserForm()
        {
            InitializeComponent();
        }



        DbUse db = new DbUse();

        /// <summary>
        /// 查找按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            //int userId = int.Parse(tbById.Text.Trim());

            var res = db.GetUsername(tbById.Text.Trim());


            tbUsername.Text = res.ToString().Trim();

        }

        private void UserForm_Load(object sender, EventArgs e)
        {
            tbUsername.ReadOnly = true;
        }
           
        /// <summary>
        /// 查找密码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click_1(object sender, EventArgs e)
        {

            int userId = int.Parse(textBox3.Text.Trim());
            string username = textBox1.Text.Trim();

            var res= db.GetUserPwd(userId, username);

            textBox2.Text = res.ToString();
        }
    }
}
